import java.util.Scanner;

class SumOfSequence {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入n的值：");
        int n = scanner.nextInt();
        System.out.print("请输入a的值：");
        int a = scanner.nextInt();
        scanner.close();

        long sum = 0; // 使用long类型以避免可能的溢出
        long term = 0; // 当前项

        for (int i = 1; i <= n; i++) {
            term = term * 10 + a; // 构建下一个项
            sum += term; // 累加到总和中
        }

        System.out.println("序列的和为: " + sum);
    }
}